package HeiMa.CollectionStudy;

import java.util.*;
import java.util.stream.Stream;

public class demo2 {
    public static void main(String[] args) {
//        Collection生成流
        List<String> list1 = new ArrayList<String>();
        Stream<String> stream1 = list1.stream();
        Set<String> set = new HashSet<String>();
        Stream<String> stream2 = set.stream();
//        Map生成流
        Map<String,Integer> map = new HashMap<String,Integer>();
        Stream<String> keyStream = map.keySet().stream();
        Stream<Integer> valueStream = map.values().stream();
        Stream<Map.Entry<String, Integer>> entryStream = map.entrySet().stream();
//        数组可以通过Stream接口的静态方法of(T ..values)生产流
        String[] strArray = {"hello","world","java"};
        Stream<String> strArrayStream = Stream.of(strArray);
        Stream<String> strArrayStream2 = Stream.of("hello", "world", "java");
        Stream.of(10, 20, 30);
    }
}
